#include <iostream>
#include <cstdio>

using namespace std;
int team[20][6] = {
        {1,  97, 90, 0,  0,  0},
        {2,  92, 85, 96, 0,  0},
        {3,  0,  0,  0,  0,  93},
        {4,  0,  0,  0,  80, 86},
        {5,  89, 83, 97, 0,  0},
        {6,  82, 86, 0,  0,  0},
        {7,  0,  0,  0,  87, 90},
        {8,  0,  97, 96, 0,  0},
        {9,  0,  0,  89, 0,  0},
        {10, 95, 99, 0,  0,  0},
        {11, 0,  0,  96, 97, 0},
        {12, 0,  0,  0,  93, 98},
        {13, 94, 91, 0,  0,  0},
        {14, 0,  83, 87, 0,  0},
        {15, 0,  0,  98, 97, 98},
        {16, 0,  0,  0,  93, 86},
        {17, 98, 83, 99, 98, 81},
        {18, 93, 87, 92, 96, 81},
        {19, 0,  0,  0,  89, 92},
        {20, 0,  99, 96, 95, 81}
};

int main() {
    int ans = 0;
    for (int i = 0; i < 20; ++i) {
        for (int j = 0; j < 20; ++j) {
            if (j != i)
                for (int k = 0; k < 20; ++k) {
                    if (k != j && k != i)
                        for (int l = 0; l < 20; ++l) {
                            if (l != k && l != j && l != i)
                                for (int m = 0; m < 20; ++m) {
                                    if (m != l && m != k && m != j && m != i) {
                                        if (team[i][1] + team[j][2] + team[k][3] + team[l][4] + team[m][5] > ans)
                                            ans = team[i][1] + team[j][2] + team[k][3] + team[l][4] + team[m][5];
                                    }
                                }
                        }
                }
        }
    }
    cout << ans << endl;
    return 0;
}

